package vow.gui.models;

import java.util.List;

import javax.swing.table.AbstractTableModel;

import ontology.models.negotiation.Proposal;

public class GeneralInfoModel extends AbstractTableModel{

	private List<Proposal> proposals;
	
	public GeneralInfoModel(List<Proposal> proposals){
		this.proposals = proposals;
	}
	
	@Override
	public int getRowCount() {
		if(proposals == null)
			return 0;
		else return proposals.size();
	}

	@Override
	public int getColumnCount() {
		return 5;
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		Proposal selected = proposals.get(rowIndex);
		if(columnIndex == 0)
			return selected.getProponent();
		if(columnIndex == 1)
			return selected.getIsNewProposal();
		if(columnIndex == 2)
			return selected.getIsAnsProposal();
		if(columnIndex == 3)
			return selected.getOutcome();
		else
			return selected.getUtility();
	}

}
